package com.umgsai.thread.thread38;

/**
 * 方法join()的作用是使所属线程对象x正常执行run()方法中的任务，
 * 而使当前线程进行无限期的阻塞。等线程x执行完毕之后再执行当前线程后续的代码。
 * @author Admin
 *
 */
public class MyThread extends Thread {
	@Override
	public void run() {
		try {
			int secondValue = (int)(Math.random() * 10000);
			System.out.println(secondValue);
			Thread.sleep(secondValue);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) throws InterruptedException {
		MyThread thread = new MyThread();
		thread.start();
//		Thread.sleep(?);
		thread.join();
		System.out.println("我想在thread对象执行完毕之后再执行");
	}
}
